package com.kgc.ssm.controller;

import com.kgc.ssm.entity.dto.QuotationResult;
import com.kgc.ssm.service.QuoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class QuoteController {
    @Autowired
    private QuoteService quoteService;
    @GetMapping("/quotetion")
    public List<QuotationResult> getQuotetion(@RequestParam List<String> materialCodes) {
        return quoteService.seleQuotationByMaterCode(materialCodes);
    }
    @DeleteMapping("/deleteQuote")
    public Boolean deleteQuote(@RequestBody List<String> queTitles) {
        return quoteService.deleteQuote(queTitles);
    }
    // 新增 POST 接口（作为备选）
    @PostMapping("/deleteQuote")
    public Map<String, Object> deleteQuotePost(@RequestBody List<String> queTitles) {
        boolean result = quoteService.deleteQuote(queTitles);
        Map<String, Object> response = new HashMap<>();
        response.put("success", result);
        return response;
    }
}
